﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using EDiamondModel;

public partial class UControl_UCSanPhamDacBiet : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            EDiamondEntities1 db = new EDiamondEntities1();
            SanPham sp = db.SanPhams.Include("DatHangCTs").OrderByDescending(p => p.DatHangCTs.Sum(x => x.SoLuong)).Take(1).FirstOrDefault();
            hinh.ImageUrl = "~/Photos/SanPham/" + sp.Hinh;
            tenSanPham.Text = sp.TenSanPham;
            tenSanPham.NavigateUrl = string.Format("~/Pages/SanPhamCT.aspx?idSP={0}", sp.SanPhamID);
            //lblMoTa.Text = sp.MoTa;
        }
    }
}